home *** CD-ROM | disk | FTP | other *** search
/ Directorty Opus 5 - Magellan 2 / Opus 5 - Magellan 2.iso / Extras / D51_NUSource / Source / DOpusFuncs / ParentToDest.s < prev    next >
Text File  |  1995-09-24  |  4KB  |  101 lines

  1. ***************************************************************************************
  2. * ParentToDest subroutine for DOpusFuncs.s                          *
  3. ***************************************************************************************
  4. ParentToDest
  5.     Tst.l    ParentToDest_S(a5)
  6.     Bne.s    ParentToDest_DoIt
  7.     RTS
  8. ParentToDest_DoIt
  9.     Sub.l    d0,d0            Abort if there isn't a source lister.
  10.     Bsr    GetSourceHandle        Get the source lister's handle -> Source_Handle
  11.     Moveq    #1,d0            Open new dest if one doesn't exist.
  12.     Bsr    GetDestHandle        Get the dest lister's handle -> Dest_Handle
  13. ;-------------------------------------------------------------------------------------;
  14. ; Build full path of first selected directory in the source lister.              ;
  15. ;-------------------------------------------------------------------------------------;
  16.     Lea    Source_Handle(a5),a0    Handle to get the path of.
  17.     Lea    PathBuffer1(a5),a1    Buffer to write path into.
  18.     Move.w    #PathBuffer1Len,d7    Size of above buffer.
  19.     Bsr    GetListerPath        Path -> buffer.
  20. ;-------------------------------------------------------------------------------------;
  21.     Bsr    Create_NIB        Create a new NudelInfoBlock for Lock()ing...
  22.     Move.l    Active_NIB(a5),a1    NIB Pointer to a1
  23.     Move.l    a1,BaseDir_NIB(a5)    Store our NIB pointer.
  24.  
  25.     Bsr    Create_NIB        Create a new NudelInfoBlock for Lock()ing...
  26.     Move.l    Active_NIB(a5),a1    NIB Pointer to a1
  27.     Move.l    a1,ParentDir_NIB(a5)    Store our NIB pointer.
  28. ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -;
  29.     Lea    PathBuffer1(a5),a0    -.
  30.     Move.l    BaseDir_NIB(a5),a1     |- Set name in BaseDir NIB for Lock()...
  31.     Move.l    a0,NIB_NameAdrs(a1)    -'
  32.     Move.l    a1,Active_NIB(a5)    Use this NIB for the Lock_NIB routine.
  33.     Moveq    #ACCESS_READ,d2        Read (shared) mode.
  34.     Bsr    Lock_NIB        Get a Lock() on the path.
  35.     Tst.l    d0
  36.     Beq_ErrorE    ErrAct_Lock(pc),BaseDir_NIB(a5)
  37. ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -;
  38.     Move.l    BaseDir_NIB(a5),a0    -._ Lock to get
  39.     Move.l    NIB_Lock(a0),d1        -'  the parent of.
  40.     N_CallDOS    ParentDir    Parent-Lock -> d0
  41.     Move.l    ParentDir_NIB(a5),a0    -._ Store new lock in NIB
  42.     Move.l    d0,NIB_Lock(a0)        -'  for automatic UnLock()
  43.  
  44. ;;;;;;;    If d0 = zero, NameFromLock() will return "SYS:".
  45. ;;;;;;;    However, in this case, it would be better to call DOpus5's DeviceList command.
  46.     Tst.l    d0
  47.     Beq.s    ParentToDest_DeviceList
  48.  
  49.     Move.l    d0,d1            Lock to get name of.
  50.     Lea    PathBuffer2(a5),a0    -._ Buffer to write
  51.     Move.l    a0,d2            -'  it into.
  52.     Move.l    #PathBuffer2Len,d3    Length of buffer.
  53.     N_CallDOS    NameFromLock    Write the name into the buffer.
  54.     Tst.l    d0
  55.     Beq_ErrorE    ErrAct_ParentDir(pc),BaseDir_NIB(a5)
  56. ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -;
  57.     Move.l    BaseDir_NIB(a5),Active_NIB(a5)    -.
  58.     Bsr    Delete_NIB             |_ Free both of the NIBs
  59.     Move.l    ParentDir_NIB(a5),Active_NIB(a5) |  Includes UnLock()ing.
  60.     Bsr    Delete_NIB            -'
  61. ;-------------------------------------------------------------------------------------;
  62.     Lea    Dest_Handle(a5),a0    Handle to read path into.
  63.     Lea    PathBuffer2(a5),a1    Path to read.
  64.     Sub.l    d0,d0            Don't force into current path buffer.
  65.     Bra    ReadListerPath        Read the path into the destination lister.
  66.  
  67. ;;;;;;;    RTS for us.
  68. ;-------------------------------------------------------------------------------------;
  69. ParentToDest_DeviceList
  70.     Move.l    BaseDir_NIB(a5),Active_NIB(a5)    -.
  71.     Bsr    Delete_NIB             |_ Free both of the NIBs
  72.     Move.l    ParentDir_NIB(a5),Active_NIB(a5) |  Includes UnLock()ing.
  73.     Bsr    Delete_NIB            -'
  74.  
  75.     Lea    Dest_Handle(a5),a0        Handle of lister.
  76.     Lea    Set_Source_SubCommand(pc),a1    Want to make it the source lister.
  77.     Sub.l    a2,a2                Don't lock it.
  78.     Bsr    ListerSet
  79.  
  80.     Lea    Device_List_Command(pc),a1    -._ Get a FULL
  81.     Bsr    FillAndSendNudelRexxMsg        -'  device list.
  82.  
  83.     Move.l    NudelRexxMsg(a5),a0
  84.     Tst.l    rm_Result1(a0)
  85.     Bne    General_DOpus_Error
  86.  
  87.     Lea    Source_Handle(a5),a0        -._ Wait for the DeviceList
  88.     Bsr    ListerWait            -'  to complete.
  89.  
  90.     Lea    Source_Handle(a5),a0        Handle of lister.
  91.     Lea    Set_Source_SubCommand(pc),a1    Want to make it the source lister.
  92.     Sub.l    a2,a2                Don't lock it.
  93.     Bra    ListerSet
  94. ;;;;;;;    RTS for us.
  95. ;-------------------------------------------------------------------------------------;
  96. ErrAct_ParentDir
  97.     Dc.b    "Could not get parent dir of ",0
  98. Device_List_Command
  99.     Dc.b    "command devicelist FULL",0
  100.     Even
  101.